#include "stdafx.h"
#include "../../GameCore/CGame.h"
#include "../../Lib/OpenGLES/GLESLib.h"

//extern "C" void InitADManager();
//extern "C" void InitADBanner();
//extern "C" void LoadOnlineData(char* name);
void CGame::UpdateLogo()
{
	if (_GameSubState == k_INIT)
	{
		//LoadResourceManifes("rm");
       // LoadOnlineData("b");
        
		//load res
		LoadSprite(GFX_LOADING);
				
		//load text
		
		
		SetSubState(k_FIRST_TIME);
	}
	else if (_GameSubState == k_LOOP)
	{
		//SetGameState(k_GS_PLAYGAME, true);
	}
	else if (_GameSubState == k_DESTROY)
	{
		SetGameState(_GameStateNew, false);
	}
}

void CGame::RenderLogo()
{
	if (_GameSubState == k_FIRST_TIME)
	{		
		SetSubState(k_LOOP);
        //InitADManager();
        //InitADBanner();
	}
	else if (_GameSubState == k_LOOP)
	{
		//render screen


		_g->SetColor(0xffffff);
		_g->FillRect(0, 0, k_SCREEN_WIDTH, k_SCREEN_HEIGHT);
		
		_g->SetColor(0xFFFF0000);
		_g->FillRect(0,0,10,20);
		
		_g->SetColor(0xFF00FF00);
		_g->FillRect(k_SCREEN_WIDTH - 20,0,20,10);
		
		_g->SetColor(0xFF0000FF);
		_g->FillRect(0,k_SCREEN_HEIGHT - 10,20,10);
		
		_g->SetColor(0xFF00FFFF);
		_g->FillRect(k_SCREEN_WIDTH - 10,k_SCREEN_HEIGHT - 20,10,20);


		//draw text
		//DrawText(GetSprite(GFX_FONT1), TXT_ASK_SOUND, MENU_TEXT, 10, 10, 0);
		//_g->ClearClip();
		//draw anim		
		//_g->SetRotate(20, 100, 100);
		GetSprite(GFX_LOADING)->DrawFrame(_g, 0, 0, 0);
		GetSprite(GFX_LOADING)->DrawFrame(_g, 2, 0, 0);
		GetSprite(GFX_LOADING)->DrawFrame(_g, 3, 0, 0);
	}
}
